﻿namespace S13Calibration
{
	/// <summary>
	/// Only use this to do log in this namespace.
	/// </summary>
	internal class Debug : FFTAI.DebugT<Debug.S13Calibration> {
		public class S13Calibration : FFTAI.DebugNamer {
			public S13Calibration() { Name = "S13Calibration"; }
		}
	}

	/// <summary>
	/// Module Class / Entry Class / Start from here.
	/// </summary>
	public class S13Calibration : FFTAI.Module
	{
		public override string Name { get { return "S13Calibration"; } }

		private CalibrationUI _calibrationUI;

        public override void OnLoad()
        {
			//加载第一个场景的prefabs
			ResourceAdd("images/Calibration.png");
			ResourceAdd("images/LeftHand.png");
			ResourceAdd("images/RightHand.png");

			ResourceAdd("animation/LeftHand.controller");
			ResourceAdd("animation/LeftHand.anim");
			ResourceAdd("animation/RightHand.controller");
			ResourceAdd("animation/RightHand.anim");
			ResourceAdd("animation/Light1.anim");
			ResourceAdd("animation/Light2.anim");
			ResourceAdd("animation/Light3.anim");
			ResourceAdd("animation/Pointer1.anim");
			ResourceAdd("animation/Pointer2.anim");

			PrefabAdd("CalibrateUI");
			PrefabAdd("CalibrateSelfUI");
			//SceneAdd("MainScene");
			ResStartLoad();
		}

		public override bool IsReady()
		{
			bool IAL = ResIsAllLoaded();
			return IAL;
		}
	
		protected override void OnEnter(object arg)
        {
			//进入后，加载第一个场景ss
			//SceneNextLoad("SceneA");
			_calibrationUI = new CalibrationUI();
			_calibrationUI.Load(this, arg);
		}

        protected override void OnUpdate()
        {

		}

        protected override void OnExit()
        {
			//最后清理
			if (_calibrationUI != null) {
				_calibrationUI.Unload();
				_calibrationUI = null;
			}
        }

		//主动卸载
		public void Unload()
		{
			if (_calibrationUI != null)
			{
				_calibrationUI.Unload();
				_calibrationUI = null;
			}

			FFTAI.Lobby.Instance.LiteModuleUnload(this);
		}
	}

	/// <summary>
	/// 校准结果
	/// </summary>
	public enum CaliResult
	{
		Success,
		Fail,
		Caling
	}

	public enum CalibrateType
	{
		Origin,
		Sensor,
		OriginAndSensor,
		SensorSelf
	}
}
